package top.zhangjianyong.tools.utils;

import java.time.LocalDateTime;

/**
 * @author ： zhangjianyong
 * @date ： 2022/4/24 下午4:51
 */
public class MailUtil {

    private static String myEmailAccount = "605600162@qq.com";
    private static String myEmailPassword = "ybrihsmjehywbdfa";
    private static String myEmailSMTPHost = "smtp.qq.com";
    //private static String receiveMailAccount = "605600162@qq.com";


    public static void send(String email, String mailSubject, String mailContext) throws Exception {

        Mail mail = new Mail(myEmailAccount, myEmailPassword, myEmailSMTPHost,
                email, mailSubject, mailContext);
        mail.SendMail();
    }

    public static void send(String mailSubject, String mailContext) throws Exception {

        Mail mail = new Mail(myEmailAccount, myEmailPassword, myEmailSMTPHost,
                myEmailAccount, mailSubject, mailContext);
        mail.SendMail();
    }

    public static void main(String[] args) {
        try {
            send("test", LocalDateTime.now().toString());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
